#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>

int my_sort(int* arr, int left, int right) 
{
	int* ret = arr;
	int temp = 0;
	while (left < right) 
	{
		while ((left < right) && (arr[left] % 2 == 1)) 
		{
			left++;
		}
		while ((left < right) && (arr[right] % 2 == 0)) 
		{
			right--;
		}
		if (left < right) 
		{
			temp = arr[left];
			arr[left] = arr[right];
			arr[right] = temp;
		}
	}
	return ret;
}

int main() 
{
	int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
	int len = sizeof(arr) / sizeof(arr[0])-1;
	for (int i = 0; i < len; i++)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
	my_sort(arr, 0, len);
	for (int i = 0; i < len; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}
